package two_shang._11_09;

import java.util.Collections;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeMap;

public class Test03 {
    public static void main(String[] args) {
        TreeMap<String, String> studentMap = new TreeMap<>(Collections.reverseOrder());

        // 添加学号和姓名到Map中
        studentMap.put("3", "Smith");
        studentMap.put("1", "Lucy");
        studentMap.put("4", "Aimee");
        studentMap.put("2", "John");
        studentMap.put("5", "Amanda");

        // 打印学号和姓名
        Set<String> keySet = studentMap.keySet();
        Iterator<String> iterator = keySet.iterator();
        while (iterator.hasNext()) {
            String studentId = iterator.next();
            String studentName = studentMap.get(studentId);
            System.out.println("学号：" + studentId + "，姓名：" + studentName);
        }

    }

}
